﻿<%@ WebHandler Language="C#" Class="CheckSignin" %>

using System;
using System.Web;

public class CheckSignin : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        string username = context.Request.QueryString["username"];
        try
        {
            HttpCookie cookie = new HttpCookie("userinfo");
            cookie["username"] = username;
            cookie.Expires = DateTime.Now.AddDays(1);
            context.Response.Cookies.Add(cookie);
        }
        catch (Exception)
        {
            context.Response.Write("0");
        }
        context.Response.Write("1");
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}